#ifndef MUSICSLIDER_H
#define MUSICSLIDER_H

#include <QWidget>

namespace Ui {
class MusicSlider;
}

class MusicSlider : public QWidget
{
    Q_OBJECT

public:
    explicit MusicSlider(QWidget *parent = nullptr);
    ~MusicSlider();

    // 移动进度条
    void moveSlider();
    // 同步歌曲的播放时间
    void setStep(float ration);

protected:
    void mouseMoveEvent(QMouseEvent *event);
    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);

signals:
    void MusicSliderChanged(float ration);

private:
    Ui::MusicSlider *ui;
    // 当前的位置
    int currentPos;
    // 最长的宽度
    int maxWidth;
};

#endif // MUSICSLIDER_H
